/**
 * 游戏数据
 *
 * @author li.youxi
 * @date 2017/05/25
 */

var data = {

	count: 0,
	step: 230,

	init: function(){
		this.count = 0;
	},

	//生成Tween对象运动参数
	configFn: function(windowWidth, windowHeight, itemHeight, itemNum){
		var random = parseInt(Math.random()*3),
			plus = (parseInt(Math.random()*2)==0)?'-': '+',
			x,
			opts;

		itemNum = itemNum || 13;

		if(plus=='-') {
			x = -windowWidth-70*random;
		}else {
			x = -windowWidth+300*random;
		}

		opts = {
			start: {
				x: 0,
				y: 0,
				rotate: 30
			},

			end: {
				x: x,
				y: windowHeight+itemHeight*3,
				rotate: 30
			},
			//动画持续时间
			duration: (1700*Math.random()+2700),
			//延迟几秒开始
			delay: this.count*this.step
		};

		if(this.count<itemNum) {
			this.count++;
		}else {
			this.count = 0;
		}
		
		//console.log(opts);

		return opts;
	}
}


module.exports = data;